<template>
	<view>
		<scroll-view class="scroll_cont" scroll-y="true">
			<view class="wrapper">
				
				<view class="fill_header">
									<view class="fill_header_title">提醒</view>
								<view class="fill_info_cont clearfix remind ">提币前请设置地址，申请成功后24小时内到账,提币手续费为{{userinfo.timoneyfei}}</view>	
								</view>
				
				
				
				<view class="cont">
					<view class="fill_info_line">
						<view class="fill_info_title">现有USDT</view>
						<view class="fill_info_cont clearfix">{{ userinfo.uMoney }}</view>
					</view>
				</view>

				<view class="cont">
					<view class="fill_info_line">
						<view class="fill_info_title">提取USDT数量</view>
						<view class="fill_info_cont clearfix"><input type="number" v-model="dataInfo.money" placeholder="请输入USDT" /></view>
					</view>
				</view>

		
		
		<view class="cont">
			<view class="fill_info_line">
				<view class="fill_info_title">提币地址</view>
				<view class="fill_info_cont clearfix">
					
					<radio-group class="uni-list" @change="pay_chage">
						<view class="uni-padding-wrap uni-common-mt" v-for="(item, index) in userinfo.accountsList" :key="index">
							
							<view class="uni-flex uni-column topmargin">
								<view class="flex-item">
									<radio :id="item.id" style="transform:scale(0.9)" :value="  '【'+item.type+'】' + item.name + item.accounts " ></radio>
									{{ item.type }}
								</view>
							
								<view >
									<text>{{item.name}}-{{item.accounts}}</text>
								</view>
								
								
							</view>
						</view>
					</radio-group>
					
					
				</view>
			</view>
		</view>
					
			

				<view class="submit_btn_cont"><button :class="issubmit ? 'nosubmit_btn' : 'submit_btn'" @click="submit" :disabled="issubmit">提币</button></view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
import validate from '@/common/ys-validate.js';


export default {
	data() {
		return {
			dataInfo: {
				img: '',
				way:''
			},
			loadpic: '', //用户上传的图片
			getimg: this.$getimg,
			issubmit: false,
			userinfo: {}
		};
	},

	onLoad() {
		this.getInfo();
	},

	onPullDownRefresh() {
		// 下拉监听事件
		this.getInfo();
		setTimeout(function() {
			uni.stopPullDownRefresh();
		}, 1000);
	},

	computed: {},
	methods: {
		getInfo(e) {
			this.$api.http.post('assistance/moneychange/getWithdrawalInfo').then(res => {
				if (res.status == 200) {
					this.userinfo = res.data;
				} else {
					this.$api.msg('获取失败');
					return false;
				}
			});
		},
		pay_chage(e) {
			this.dataInfo.way = e.detail.value;
		},
	

		submit() {
			if (!validate.isNumber(this.dataInfo.money)) {
				this.$api.msg('USDT输入有误');
				return false;
			}

			if (parseFloat(this.dataInfo.money) > this.userinfo.uMoney) {
				this.$api.msg('USDT不能大于'+this.userinfo.uMoney );
				return false;
			}

			if (this.dataInfo.way == '') {
				this.$api.msg('请选择提现方式');
				return false;
			}
			
		

			this.issubmit = true; //禁用按钮
			var _self = this;
			this.$api.http.post('assistance/moneychange/withdrawal', this.dataInfo).then(res => {
				if (res.status == 200) {
					//成功执行
					uni.showToast({
						icon: 'none',
						title: res.msg,
						mask: true,
						success() {
							setTimeout(() => {
							uni.removeStorageSync('my');//清除我的信息
								uni.navigateBack();
							}, 1000);
						}
					});
				} else {
					_self.issubmit = false; //启用按钮
					uni.showToast({
						icon: 'none',
						title: res.msg,
						mask: true
					});

					return false;
				}
			});
		}
	}
};
</script>

<style lang="scss">
.remind {
	color: #f1c013;
	font-size: 26upx;
}

.clearfix {
	zoom: 1;
	display: block;
}

.noShow {
	display: none;
}

.clearfix:after {
	content: '.';
	visibility: hidden;
	display: block;
	height: 0;
	clear: both;
}

.scroll_cont {
	background-color: #f5f5f5;
	height: 100vh;
	padding: 20upx;

	.wrapper {
		.fill_header {
			border-radius: 5upx;
			background-color: #ffffff;
			padding: 40upx;
			margin-bottom: 20upx;
			.fill_header_title {
				font-size: 26upx;
			}
			.fill_header_cont {
				margin-top: 30upx;
				.photo_img_cont {
					border: 1upx solid hsla(0, 0%, 60%, 0.3);
					width: 120upx;
					height: 120upx;
					padding: 20upx;

					.photo_img {
						width: 80upx;
						height: 80upx;
					}
				}
			}
		}

		.cont {
			border-radius: 5upx;
			background-color: #ffffff;
			padding: 40upx;

			.fill_info_line {
				margin-top: 30upx;

				.fill_info_title {
					font-size: 26upx;
				}

				.fill_info_cont {
					position: relative;
					border-bottom: 1upx solid hsla(0, 0%, 60%, 0.3);

					.pwdInput {
						font-size: 26upx;
						height: 80upx;
						line-height: 80upx;
						border: none;
						display: block;
						outline: none;
					}

					.pwd_icon {
						width: 85upx;
						height: 85upx;
						-webkit-transform: scale(0.4);
						transform: scale(0.4);
						position: absolute;
						top: 0;
						right: 0;
					}
				}
				.fill_info_another {
					border-bottom: 1upx solid hsla(0, 0%, 60%, 0.3);
					margin-top: 24upx;
					label {
						font-size: 14upx;
					}
				}
				.checkbox_line {
					padding: 0 0px 14px;
					.uni-input {
						text-indent: 0;
						background: #ffffff;
					}
				}
			}

			.fill_info_line:first-child {
				margin-top: 0;
			}
		}
	}

	.submit_btn_cont {
		margin-top: 20upx;

		.submit_btn {
			border-radius: 5upx;
			color: #ffffff;
			font-size: 26upx;
			background: linear-gradient(90deg, #4e8cff, #2f79ff);
		}

		.nosubmit_btn {
			border-radius: 5upx;
			color: #ffffff;
			font-size: 26upx;
			background: linear-gradient(90deg, #c6c5c5, #cdced0);
		}
	}

	.topmargin {
		margin-bottom: 10upx;
	}

	.photo_sign {
		background-color: #fafafa;
		text-align: center;
		width: 240upx;
		height: 240upx;
		color: #dcdcdc;
		.photo_icon {
			width: 60upx;
			height: 60upx;
			margin: 26upx 0 10upx;
		}
		.photo_text_b {
			font-size: 18upx;
		}
		.photo_text_s {
			margin-top: 6upx;
			font-size: 16upx;
		}
		.photo_preview {
			width: 100%;
			height: 100%;
		}
	}
	
	
	.flex-item{
		margin-bottom: 10upx;
		
	}
}
</style>
